

const defaultState = {
    inputValue:'',
    list:[]
}
const reducer = (state =defaultState, action) => {
    let newState = JSON.parse(JSON.stringify(state));
    console.log(action.type)
    switch (action.type) {
        case "change_input_value":
            newState.inputValue = action.value;
            return newState
        case "add_item":
            newState.list.push(newState.inputValue)
            newState.inputValue=""
            return newState

    }
        return state
};



export default reducer